home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The X-Philes (2nd Revision)
/
The X-Philes Number 1 (1995).iso
/
xphiles
/
hp48_1
/
ham_jg
< prev
next >
Wrap
Internet Message Format
|
1995-03-31
|
16KB
From: James Gentles <jdg@hpqtdla.sqf.hp.com>
Subject: v04i002: ham_jg - Ham Radio translations v1.0, Part01/01
Newsgroups: comp.sources.hp48
Followup-To: comp.sys.hp48
Approved: spell@seq.uncwil.edu
Checksum: 3795858353 (verify with brik -cv)
Submitted-by: James Gentles <jdg@hpqtdla.sqf.hp.com>
Posting-number: Volume 4, Issue 2
Archive-name: ham_jg/part01
BEGIN_RDM ham.rdm
Posted below is a collection of HP48 programs for Radio Amateurs. They are
complete with documentation so it's all self explanitory...
Ham_radio: Various Ham Radio translations, great circle and horizon routines.
Comments, or queries to me at the above address.
James
---------------------------------------------------------------------
I have no professional connection with Hewlett-Packard's
calculator operations other than as a user of their products.
---------------------------------------------------------------------
Opinions expressed are my own, and are not intended to be an official
statement by Hewlett-Packard Company
---------------------------------------------------------------------
To strive, to seek, to find, and not to yield. Tennyson, "Ulysses".
---------------------------------------------------------------------
James Gentles Hewlett Packard, Amateur: GM4WZP
Queensferry Telecoms Division QTD, Email: jdg@hpsqf.sqf.hp.com
Station Road, South Queensferry, HPDESK: James Gentles / HP1400
West Lothian, Scotland, EH30 9XR. Phone: + 44 31 331 7663 DDI
---------------------------------------------------------------------
END_RDM
BEGIN_DOC ham.doc
Radio Amateur Routines for the HP48
QRA to Latitude/Longitude CONVERSION,
GREAT CIRCLE DISTANCES and HORIZONS
James Gentles
jdg@hpsqf.sqf.hp.com
February 1992
1. Introduction
2. Pseudo Code for Main Routines
3. HP48 Routines: Descriptions
4. HP48 Routines: Programs (ASCII DIR Object)
1. Introduction
This file contains a collection of HP48 programs for translating between
the QRA or Maidenhead locator system used by Radio Amateurs and Lat/Long,
calculating Great Circle Distances and bearings, and calculating Radio
Horizons.
Also of interest may be a companion set of HP48 routines for performing
Transverse Mercator Projection. This will allow additional translation
between this common mapping projection and Latitude/Longitude. For example,
this is especially useful in the UK, where Amateurs also quote their "WAB"
(Worked All Britain) square, which is based on the "National Grid" which is
a Transverse Mercator Projection.
For those interested in coding these routines in other machines I have
included psudo-code descriptions of the main routines. However the main
code that follows is written for the HP48. It was originally written for a
HP28, but has been improved in the process of translation to the HP48. The
code is smaller, faster, and also takes advantage of the HP48's improved
language, e.g. TAGing.
2. Pseudo Code for Main Routines
This pseudo-code is based on the following HP48 routines. The pseudo-code uses
mostly two letter variable names, this does not aid readability, however
these are the calculator local variables. Leaving the variables like this
means that no errors have been introduced in the translation to pseudo-code
from HP48 code.
Latitude / Longitude to QRA Conversion
Note: All calculations in degrees
lo = longitude + 180 offset origin to -180degrees longitude,
La = latitude + 90 -90degrees latitude.
C1 = ASCII CHAR ('IP(lo/20)+65')
C2 = ASCII CHAR ('IP(la/10)+65')
C3 = ASCII CHAR ('IP(FP(lo/20)*10)+48')
C4 = ASCII CHAR ('IP(FP(la/10)*10)+48')
C5 = ASCII CHAR ('IP(FP(lo/2)*24)+65')
C6 = ASCII CHAR ('IP(FP(la)*24)+65')
QRA Locator = String C1+C2+C3+C4+C5+C6
QRA to Latitude / Longitude Conversion
First break QRA string into 6 numbers, representing the ASCII number equivilent
to each of the 6 characters making up the QRA. Call them a b c d e & f.
Latitude = 'b*10+(d+17)+f/24+1/48-90'
Longitude = 'a*20+(c+17)*2+e/12+1/24-180'
Great Circle Calculations.
dif = longitute home - longitute away
(this should be within -180 to +180 degrees)
(Hint: This number should be non-zero, programs should check for
this and make dif=0.0001 as a minimum)
lah = latitude of home
laa = latitude of away
ERAD= Radius of the earth (e.g. 6378.388 Km)
dis = 'ACOS(SIN(lah)*SIN(laa)+COS(lah)*COS(laa)*COS(dif))'
distance = dis /180 *pi *ERAD
angle = 'ACOS((SIN(laa)-SIN(lah)*COS(dis))/(COS(lah)*SIN(dis)))'
Line of Sight and Radio Horizon Routines
ERAD = 6378.388Km (Radius of the Earth in Km)
Radio Horizon (Km) = SQRT('height*ERAD*8/3')
ERAD = 6378.388Km (Radius of the Earth in Km)
Sight Horizon (Km) = SQRT('height*ERAD*2')
3. HP48 Routines: Descriptions
QRA Locator Square Translator: The following procedures translate between
the worldwide QRA (or ANB or Maidenhead, whatever its called) locator
system used by Radio Amateurs and latitude / longitude.
->QRA Takes Latitude from stack level 2, and Longitude from level 1
and returns a string with the Locator. South and West are
negative. The input should be in DD.MMSS format. For example,
take QTH ->QRA gives "IO85HX" for my locator.
QRA-> Takes a string from the stack level 1 and returns the Latitude
in level 2 and Longitude in level 1 of the square center. This
is the inverse of ->QRA. The output is in DD.MMSS.
Great Circle Distance & Bearings: Calculates the distance between your
station and the remote station, also gives beam heading required.
GCIR Takes the output of QRA-> (Lat and Long) and uses the Lat and
Long in QTH to compute the great circle distance and bearing
from QTH to the stack Lat and Long. The distance is returned
in Level 2, in the current units of ERAD. The bearing, in
DD.MMSS from north (+E,-W) is returned in Level 1. This program
assumes the earth is a perfect sphere ( we all know this is an
approximation as the earth is actually flat :-). This program
uses the PRESERVE routine given in the HP48 Manual II, page 555
to ensure flags are preserved after degrees mode is used.
QTH Must contain the two numbers << Lat Long >> representing your
stations position, in degrees, minutes and seconds.
ERAD Must contain the equatorial radius of the earth. I use:
3963.34655611_mi
which is in miles. Thus the answer to GCIR, HORIZ and LOFS
will be in miles, You can use the HP48's units management to
change this constant if you wish.
Radio Horizon: Calculates the flat-band line of sight communication
distance at VHF.
HORIZ Returns the distance between a point on the earth and the
VHF radio 'horizon' given the height above sea level. The
height is taken from level 1, and the distance returned in
level 1. The height can be in any desired unit, e.g. 3000_ft,
note however that the answer will always be in the current
unit associated with ERAD. This allows appropriate units to
be used for heights and distances. If the height entered is
in the base unit of metre's then it does not need the _m
suffix. This calculation is NOT the same as the line of sight
horizon, as it includes a correction of SQRT(4/3) to allow
for tropospheric bending.
LOFS Line of Sight. Same as HORIZ but does not take into account
any bending, can be used for frequencies above VHF or light.
External programs used (included in the listing for completeness):
PRESERVE Returns flags to initial state on program exit. Used in GCIR
routine. See HP48SX Manual II page 555.
END_DOC
BEGIN_RPL ham.rpl
%%HP: T(3)A(D)F(.);
DIR
\->QRA @ Lat & Long to QRA translation
\<< HMS\-> 180 + SWAP HMS\-> 90 + @ offset lat/long to "bottom left corner"
\-> lo la
\<< lo 20 / IP 65 + CHR
la 10 / IP 65 + CHR
lo 20 / FP 10 * IP 48 + CHR
la 10 / FP 10 * IP 48 + CHR
lo 2 / FP 24 * IP 65 + CHR
la FP 24 * IP 65 + CHR
\>> + + + + + "QRA" \->TAG
\>>
QRA\-> @ QRA to Lat & Long translation
\<< 1 6 FOR i
i PICK i DUP SUB NUM 65 -
NEXT \-> a b c d e f @ break string into numerical elements
\<< DROP
b 10 * d 17 + f 24 / 48 INV
+ + +
90 - \->HMS "Lat\^o" \->TAG
a 20 * c 17 + 2 * e 12 / 24 INV
+ + +
180 - \->HMS "Long\^o" \->TAG
\>>
\>>
GCIR
\<<
\<< DEG HMS\->
SWAP HMS\-> QTH HMS\->
SWAP HMS\-> 4 ROLLD
ROT - DUP
IF 180 >
THEN 360 -
END
DUP
IF -180 <
THEN 360 +
END
IF DUP 0 == THEN .0001 + END @ ensure divisor is non zero
\-> lh la d
\<<
'ACOS(SIN(lh)*SIN(la)+COS(lh)*
COS(la)*COS(d))' \->NUM
DUP 180 / \pi * ERAD * \->NUM
SWAP \-> ds
\<<
'ACOS((SIN(la)-SIN(lh)*COS(ds))
/(COS(lh)*SIN(ds)))' \->NUM
\>>
IF d 0 > THEN NEG END @ correction for E or W of N
\->HMS "\177\^oN" \->TAG
\>>
\>> PRESERVE
\>>
HORIZ
\<<
IF DEPTH
THEN
ERAD * 8 * 3 / UBASE \v/ ERAD
CONVERT
ELSE
"HORIZ
hgt_ \-> dist_"
DOERR
END
\>>
LOFS
\<<
IF DEPTH
THEN ERAD * 2 * UBASE \v/ ERAD
CONVERT
ELSE
"LOFS
hgt_ \-> dist_"
DOERR
END
\>>
ERAD @ Radius of the earth in any
'3963.34655611_mi' @ appropriate unit.
QTH @ location of station for
WZP @ great circle calculations.
WZP
\<< :Lat\^o: 55.591 @ data is in D.MMSSsss form.
:Long\^o: -3.244
\>>
@
PRESERVE @ See HP48SX Manual II page 555.
\<< RCLF \-> f @ May be more suitably located in HOME
\<< EVAL f STOF
\>>
\>>
END
END_RPL
BEGIN_ASC ham.asc
%%HP: T(3)A(D)F(.);
"69A20FF7468000000080052554355425655480D9D20E1632916C11C432D6E201
066E1632EB3A1D6E201066F76C1EF53293632B2130850003075A50530D9D20E1
632CFA2040C416470B339201000000000195550CFA2050C4F6E6760B33920000
000000004423993632B213086000301545843084E203075A5057100040542514
4440ADA20339203001165564336930C2A2090000D69668B01B2130E300040C4F
4643540D9D20E16323CE2244CF1AFE22D9D2084E204054251444EEDA1ED2A2EE
DA117791473B184E204054251444BD691B21305BF22D9D20C2A2072000C4F464
35A0867647F502D80246963747F5933A1B21305DF2293632B2130AB0005084F4
2594A550D9D20E16323CE2244CF1AFE22D9D2084E204054251444EEDA1C53A2E
EDA13F2A250FA117791473B184E204054251444BD691B21305BF22D9D20C2A20
9200084F42594A5A0867647F502D80246963747F5933A1B21305DF2293632B21
308C000407434942540D9D20E1632C9432D9D20E1632993C1E3FB1DBBF1E3FB1
84E2030154584E3FB1DBBF1E3FB1803A20DCF1E0CF190DA178BF13CE22339202
000000000000810D5CE1AFE22D9D2033920200000000000063090DA1B21305DF
2278BF13CE22339202000000000000819EBBE1AFE22D9D203392020000000000
0063076BA1B21305DF223CE2278BF14B2A2279E1AFE22D9D2033920699000000
000001076BA1B21305DF221C432D6E2020C686D6E2020C616D6E201046E16328
BA20D6E2020C686CA4B1D6E2020C616CA4B1EEDA1D6E2020C686505B1D6E2020
C616505B1EEDA1D6E201046505B1EEDA176BA1F27B1B21304E5A178BF1339202
00000000000081050FA1DBAA1EEDA184E204054251444EEDA14E5A1DBBF11C43
2D6E20204637E16328BA20D6E2020C616CA4B1D6E2020C686CA4B1D6E2020463
7505B1EEDA190DA1D6E2020C686505B1D6E20204637CA4B1EEDA150FA1F27B1B
21304E5A1EF5323CE22D6E2010464B2A2D5CE1AFE22599A15DF22E1FB1C2A20B
00001B0BE4EB522EF53293632B213084E2080052554355425655493632B21308
330040152514D840D9D20E16329C2A2233A20A132D6E201096D6E201096A9CF1
D6E20109678BF1C58C164BC133920100000000000056090DA1C42321C432D6E2
01016D6E201026D6E201036D6E201046D6E201056D6E201066E16328DBF1D6E2
01026339201000000000000010EEDA1D6E20104633920100000000000071076B
A1D6E20106633920100000000000042050FA1339201000000000000840872B17
6BA176BA176BA133920100000000000009090DA1E1FB1C2A20D0000C416470BE
B522D6E201016339201000000000000020EEDA1D6E2010363392010000000000
0071076BA1ED2A2EEDA1D6E20105633920100000000000021050FA1339201000
000000000420872B176BA176BA176BA133920200000000000081090DA1E1FB1C
2A20F0000C4F6E6760BEB522EF53293632B21303620040D815251440D9D20E16
32E3FB133920200000000000081076BA1DBBF1E3FB1339201000000000000090
76BA11C432D6E2020C6F6D6E2020C616E1632D6E2020C6F63392010000000000
0002050FA1D6BB133920100000000000056076BA166BC1D6E2020C6163392010
0000000000001050FA1D6BB133920100000000000056076BA166BC1D6E2020C6
F633920100000000000002050FA13ABB1339201000000000000010EEDA1D6BB1
33920100000000000084076BA166BC1D6E2020C6163392010000000000000105
0FA13ABB1339201000000000000010EEDA1D6BB133920100000000000084076B
A166BC1D6E2020C6F6ED2A250FA13ABB1339201000000000000420EEDA1D6BB1
33920100000000000056076BA166BC1D6E2020C6163ABB133920100000000000
0420EEDA1D6BB133920100000000000056076BA166BC1EF53276BA176BA176BA
176BA176BA1C2A20B0000152514EB52293632B2130F750"
END_ASC
BYTES: #57Fh 1436.5
BEGIN_UU ham.uue
begin 644 ham
M2%!(4#0X+466*O!_9`@````(4%)%4T525D4(G2W@82,9QA%,(VTN$F82.^Z
MH]'F`@%F?\;A7R,Y-K(2`U@`,'"E!370V0(>-L*O`@1,872P,RD0`````!!9W
M5<"O`@5,;VY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y@(!9#,I$```````!
M`!=PMAIM+A!@-I,"`0``````0`(%KS&3`@$``````(`$>+)QMAIGJW&V&C,I3
M$````````)"0T!H>O\&B`@T`P!1&!^M;(FTN$!`VDP(!`````````NZMT>8"Y
M`6,S*1`````````7<+8:WJ+BWAIM+A!0-I,"`0``````(`$%KS&3`@$`````9
M`$`">+)QMAIGJW&V&C,I(````````!B0T!H>O\&B`@\`P/3F=@;K6R+^-9)C%
M(RLQ,"8`!(U14D$$G2W@82,^OS&3`@(``````(`!9ZO1NQ\^OS&3`@$`````'
M```)9ZL13"-M+B#`]M;F`@)L81XVTN8"`FQO,RD0````````(%#P&FV[,9,"S
M`0``````4`9GJV&V'&TN(,`6-I,"`0````````$%K]&V&S,I$````````&5P7
MMAIFR]'F`@)L;S,I$````````"!0\!JCNS&3`@$````````![JW1MALS*1``&
M``````!(<+8:9LO1Y@(";&$S*1`````````04/`:H[LQDP(!`````````>ZML
MT;8;,RD0````````2'"V&F;+T>8"`FQOWJ)2\!JCNS&3`@$``````$`"[JW1@
MMALS*1````````!E<+8:9LO1Y@(";&&CNS&3`@$``````$`"[JW1MALS*1``2
J``````!E<+8:9LOA7R-GJW&V&F>K<;8:9ZO!H@(+`!`E%>1;(CDVLA(#\
``
end
END_UU